%!ps

/sq {dup mul} def %   % x sq x²
/db {2 mul} def   % x db 2x
/next_guess {dup db 3 1 roll sq div add 3 div} def   % x y(n) next_guess y(n+1)
/good_enough {div     % y(n-1) y(n) good_enough  wether sqrt3(x) within aceptable error range
               1.0 sub abs 1e-6  lt
              {true} {false}
              ifelse} def
/sqr3 {              % x sqr3 x^(1/3)
  1 %first guess
    {
       2 copy
       next_guess 
       dup 3 1 roll 
       good_enough {exch pop exit} if
    } loop
} def

% tests:
27 sqr3 3 eq = 
1e36 sqr3 1e12 eq =
1e-36 sqr3 1e-12 eq =
% for 1e39, gs's floating implementation introduces noise (on an i386)